﻿using H2.NET.Web.Workflow.DwzCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using H2.NET.Web.Workflow.Helper;
using H2.NET.Common;

namespace H2.NET.Web.Pages.SMD
{
    public partial class taskview : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var showbtn = AksRequest.GetString("showbtn");

            var processName = TaskAPI.Process;
            var key = TaskAPI.GetVariableBySingleValue("AutoBusinessKey");
            if (processName == "Store Data Change")
            {
                var action = TaskAPI.GetVariableBySingleValue("Actions");

                if (string.IsNullOrEmpty(action))
                {
                    Server.Transfer("~/Pages/SMD/ChangeStore.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID, true);
                }
                else
                {
                    Server.Transfer("~/Pages/SMD/" + action + ".aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID, true);
                }
            }
            else if (processName == "New Store Application")
            {
                Server.Transfer("~/Pages/SMD/Store.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID, true);
            }
            else if (processName == "Store Deposit Change")
            {
                if (key == Constant.PROCESS_BATCHDEPOSIT)
                {
                    Server.Transfer(
                        "~/Pages/SMD/BatchDepositChange.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" +
                        TaskAPI.TaskID, true);
                }
                else
                    Server.Transfer(
                        "~/Pages/SMD/DepositChange.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID,
                        true);
            }
            else if (processName == "Store Deposit Receive")
            {
                Server.Transfer("~/Pages/SMD/ReceiveDeposit.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID, true);
            }
            else if (processName == "MDC Itss")
            {
                Server.Transfer("~/Pages/SMD/MDCItss.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID, true);
            }
            else if (processName == "New Store Deposit Receive")
            {
                Server.Transfer("~/Pages/SMD/NewReceiveDeposit.aspx?readonly=1&showbtn=" + showbtn + "&taskid=" + TaskAPI.TaskID, true);
            }
        }
    }
}